<!--
 * @Descripttion: 
 * @version: 
 * @Author: lsy
 * @Date: 2021-12-10 10:25:08
 * @LastEditors: lsy
 * @LastEditTime: 2021-12-15 10:33:39
-->
<template>
    <div id="info_div">
        <a-badge :dot="infoObj.totalRows != 0 && taskObj.totalRows != 0">
            <a-button type="link" icon="mail" @click="toinfo()" />
        </a-badge>
        <!-- <div class="info_tooltip">
            <a-tabs default-active-key="1">
                <a-tab-pane key="1" tab="通知"></a-tab-pane>
                <a-tab-pane key="2" tab="任务"></a-tab-pane>
            </a-tabs>
        </div>-->
    </div>
</template>
<script>
import { formatDate } from "@/utils/index.js"
export default {
    name: "info",
    data() {
        return {
            infoObj: { totalRows: 0 },
            taskObj: { totalRows: 0 }
        }
    },
    mounted() {
        this.getData();
    },
    methods: {
        getData() {
            let endTime = formatDate(new Date());
            let start = (new Date()).getTime() / 1000 - 864000;
            let startTime = formatDate(new Date(start * 1000));
            let infoParam = {
                infoEndDateString: endTime,
                infoStartDateString: startTime,
                infoStateList: [],
                infoTypeList: [],
                pageNum: 1,
                pageSize: 10,
                searchKey: "",
            }
            VE_API.info.getRealTimeInfo(infoParam).then(res => {
                this.infoObj = res.data.data;
            })

            let taskParam = {
                handleStateList: [0],
                pageNum: 1,
                pageSize: 10,
                searchWay: 1,
                sort: "transmitDate",
                sortType: "DESC"
            }
            VE_API.info.getTaskInfo(taskParam).then(res => {
                this.taskObj = res.data.data;
            })
        },
        toinfo() {
            window.changeCurrentTab({
                "menuCode": "001005",
                "uniqueMenuCode": "EVOEVENT_001005",
                "menuName": "evo.event.message",
                "menuPath": "/ec/#/message",
                "menuType": 1,
                "module": "module_default_system.config",
                "menuSort": 11,
                "systemCode": "evo-event",
                "customNameFlag": 0,
            });
        }
    }
}
</script>
<style lang="scss" scoped>
#info_div {
    display: inline-block;
    .info_tooltip {
        width: 250px;
        height: 300px;
        position: absolute;
        top: 50px;
        right: 80px;
        display: none;
        text-align: center;
        background-color: rgb(255, 255, 255);
        border-radius: 10px;
        border: 1px solid rgb(221, 221, 221);
        box-shadow: 5px 5px 3px #aaa9a9;
    }
    &:hover {
        .info_tooltip {
            display: inline-block;
            z-index: 1000;
        }
    }
}
.ant-btn-link {
    color: rgb(207, 206, 206);
    &:hover {
        color: white;
    }
}
</style>